home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1998 September
/
Macworld (1998-09).dmg
/
Shareware World
/
Info
/
For Developers
/
MacZoop 1.8.3
/
Required Classes
/
Z Sources
/
ZGrafState.cp
< prev
next >
Wrap
Text File
|
1998-05-14
|
1KB
|
67 lines
/*************************************************************************************************
*
*
* MacZoop - "the framework for the rest of us"
*
*
*
* ZGrafState.cp -- a simple object for saving and restoring grafport state
*
*
* © 1997, Graham Cox
*
*
*
*************************************************************************************************/
#include "ZGrafState.h"
#include <QDOffscreen.h>
ZGrafState::ZGrafState()
{
clip = NewRgn();
Record();
}
ZGrafState::~ZGrafState()
{
Restore();
DisposeRgn( clip );
}
void ZGrafState::Record()
{
GetGWorld( &port, &dev );
GetClip( clip );
GetPenState( &pen );
GetBackColor( &back );
GetForeColor( &fore );
font = port->txFont;
fSize = port->txSize;
fStyle = port->txFace;
fMode = port->txMode;
}
void ZGrafState::Restore()
{
SetGWorld( port, dev );
SetClip( clip );
SetPenState( &pen );
RGBForeColor( &fore );
RGBBackColor( &back );
TextFont( font );
TextSize( fSize );
TextFace( fStyle );
TextMode( fMode );
}